import Vue from 'vue'
import Router from 'vue-router'

import IndexHome from '@/components/IndexHome'
import BackHome from '@/components/BackHome'
import UserHome from '@/components/UserHome'
import Login from '@/components/Login'
import AppIndex from '@/components/AppIndex'
import ChooseClass from '@/components/index/ChooseClass'

import CourseManage from '../components/back/course/CourseManage'
import CourseManageIndex from '../components/back/course/CourseManageIndex'
import CourseManageMain from '../components/back/course/CourseManageMain'
import CManageClass from '../components/back/course/CManageClass'
import CreateCourse from '../components/back/course/CreateCrouse'
import Favorite from '../components/back/course/Favorite'
import Note from '../components/back/course/Note'

import UserCenter from '../components/back/user/UserCenter'
import UserBinding from '../components/back/user/UserBinding'
import UserInfo from '../components/back/user/UserInfo'
import RecordShow from '../components/back/user/RecordShow'

import CourseDetail from '../components/index/course/CourseDetail'
import CourseCs from '../components/index/course/CourseCS'
import CourseQC from '../components/index/course/CourseQC'
import CourseNote from '../components/index/course/CourseNote'
import CourseEV from '../components/index/course/CourseEV'
import CourseLearn from '../components/index/course/CourseLearn'

import ManageHome from '../components/ManageHome'
import UserAnalysis from '../components/manage/userManage/UserAnalysis'
import CourseManageList from '../components/manage/courseManage/CourseManage'
import DirectionManage from '../components/manage/courseManage/DirectionManage'
import SortManage from '../components/manage/courseManage/SortManage'
import CreateAnnounce from '../components/manage/messageManage/CreateAnnounce'
import AnnounceList from '../components/manage/messageManage/AnnounceList'
import BaseInfo from '../components/manage/webManage/BaseInfo'
import PathManage from '../components/manage/webManage/PathManage'
import QADetail from '../components/index/course/QADetail'
import MyCourse from '../components/back/course/MyCourse'
import Question from '../components/back/course/Question'
import CourseAna from '../components/back/course/CourseAna'
import StudentAna from '../components/back/course/StudentAna'
import RoleManage from '../components/manage/userManage/RoleManage'
import UserList from '../components/manage/userManage/UserList'
import CourseAudit from '../components/manage/courseManage/CourseAudit'
import NotifyList from '../components/index/NotifyList'
import TeacherApprove from '../components/back/user/TeacherApprove'
import UserApprove from '../components/manage/userManage/UserApprove'
import ADManage from '../components/manage/webManage/ADManage'
import CourseFile from '../components/index/course/CourseFile'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/index',
      meta: {
        title: '首页'
      }
    },
    /* 前台 */
    {
      path: '/indexHome',
      name: 'indexHome',
      component: IndexHome,
      meta: {
        title: '首页'
      },
      redirect: '/index',
      children: [
        {
          path: '/index',
          name: 'AppIndex',
          component: AppIndex,
          meta: {
            title: '首页'
          }
        },
        {
          path: '/login',
          name: 'Login',
          component: Login,
          meta: {
            title: '登录'
          }
        },
        {
          path: '/class',
          name: 'Class',
          component: ChooseClass,
          meta: {
            requestAuth: true,
            title: '课程'
          }
        },
        {
          path: '/learn',
          name: 'Learn',
          component: CourseDetail,
          redirect: '/learn/courseCs',
          meta: {requestAuth: true},
          children: [
            {
              path: '/learn/courseCs',
              name: 'CourseCs',
              component: CourseCs,
              meta: {
                requestAuth: true,
                title: '学习'
              }
            },
            {
              path: '/learn/courseQC',
              name: 'CourseQC',
              component: CourseQC,
              meta: {
                requestAuth: true
              }
            },
            {
              path: '/learn/courseNote',
              name: 'CourseNote',
              component: CourseNote,
              meta: {
                requestAuth: true
              }
            },
            {
              path: '/learn/courseEv',
              name: 'CourseEv',
              component: CourseEV,
              meta: {
                requestAuth: true
              }
            }
          ]
        }
      ]
    },
    // 后台
    {
      path: '/backHome',
      name: 'backHome',
      component: BackHome,
      children: [
        {
          path: '/backHome/courseManage',
          name: 'courseManage',
          component: CourseManage,
          redirect: '/backHome/courseManage/index',
          children: [
            {
              path: '/backHome/courseManage/index',
              name: 'CourseManageIndex',
              component: CourseManageIndex,
              meta: {
                requestAuth: true,
                title: '首页-课程管理'
              }
            },
            {
              path: '/backHome/courseManage/cManageClass',
              name: 'CManageClass',
              component: CManageClass,
              meta: {
                requestAuth: true,
                title: '课程管理-教师'
              }
            },
            {
              path: '/backHome/courseManage/createCourse',
              name: 'CreateCourse',
              component: CreateCourse,
              meta: {
                requestAuth: true,
                title: '创建课程'
              }
            },
            {
              path: '/backHome/courseManage/courseAna',
              name: 'CourseAna',
              component: CourseAna,
              meta: {
                requestAuth: true,
                title: '课程分析'
              }
            },
            {
              path: '/backHome/courseManage/studentAna',
              name: 'StudentAna',
              component: StudentAna,
              meta: {
                requestAuth: true,
                title: '学员分析'
              }
            },
            {
              path: '/backHome/courseManage/myCourse',
              name: 'MyCourse',
              component: MyCourse,
              meta: {
                requestAuth: true,
                title: '我的课程'
              }
            },
            {
              path: '/backHome/courseManage/favorite',
              name: 'Favorite',
              component: Favorite,
              meta: {
                requestAuth: true,
                title: '我的收藏'
              }
            },
            {
              path: '/backHome/courseManage/note',
              name: 'Note',
              component: Note,
              meta: {
                requestAuth: true,
                title: '我的笔记'
              }
            },
            {
              path: '/backHome/courseManage/question',
              name: 'uQuestion',
              component: Question,
              meta: {
                requestAuth: true,
                title: '我的问答'
              }
            }
          ]
        }
      ]
    },
    // 用户中心
    {
      path: '/userHome',
      name: 'userHome',
      component: UserHome,
      children: [
        {
          path: '/userHome/userCenter',
          name: 'UserCenter',
          component: UserCenter,
          redirect: '/userHome/userCenter/userBinding',
          children: [
            {
              path: '/userHome/userCenter/userBinding',
              name: 'UserBinding',
              component: UserBinding,
              meta: {
                requestAuth: true,
                title: '用户绑定'
              }
            },
            {
              path: '/userHome/userCenter/userInfo',
              name: 'UserInfo',
              component: UserInfo,
              meta: {
                requestAuth: true,
                title: '用户信息'
              }
            },
            {
              path: '/userHome/userCenter/recordShow',
              name: 'RecordShow',
              component: RecordShow,
              meta: {
                requestAuth: true,
                title: '记录展示'
              }
            },
            {
              path: '/userHome/userCenter/teacherApprove',
              name: 'TeacherApprove',
              component: TeacherApprove,
              meta: {
                requestAuth: true,
                title: '认证教师'
              }
            }
          ]
        }
      ]
    },
    // 管理
    {
      path: '/manageHome',
      name: 'ManageHome',
      component: ManageHome,
      meta: {
        requestAuth: true,
        title: '首页-管理'
      },
      children: [
        {
          path: '/manageHome/userList',
          name: 'UserList',
          component: UserList,
          meta: {
            requestAuth: true,
            title: '用户列表-管理'
          }
        },
        {
          path: '/manageHome/userAnalysis',
          name: 'UserAnalysis',
          component: UserAnalysis,
          meta: {
            requestAuth: true,
            title: '用户分析-管理'
          }
        },
        {
          path: '/manageHome/userApprove',
          name: 'UserApprove',
          component: UserApprove,
          meta: {
            requestAuth: true,
            title: '用户认证-管理'
          }
        },
        {
          path: '/manageHome/roleManage',
          name: 'RoleManage',
          component: RoleManage,
          meta: {
            requestAuth: true,
            title: '角色管理-管理'
          }
        },
        {
          path: '/manageHome/courseManage',
          name: 'CourseManage',
          component: CourseManageList,
          meta: {
            requestAuth: true,
            title: '课程管理-管理'
          }
        },
        {
          path: '/manageHome/courseAudit',
          name: 'CourseAudit',
          component: CourseAudit,
          meta: {
            requestAuth: true,
            title: '课程审核-管理'
          }
        },
        {
          path: '/manageHome/directionManage',
          name: 'DirectionManage',
          component: DirectionManage,
          meta: {
            requestAuth: true,
            title: '方向管理-管理'
          }
        },
        {
          path: '/manageHome/sortManage',
          name: 'SortManage',
          component: SortManage,
          meta: {
            requestAuth: true,
            title: '分类管理-管理'
          }
        },
        {
          path: '/manageHome/createAnnounce',
          name: 'CreateAnnounce',
          component: CreateAnnounce,
          meta: {
            requestAuth: true,
            title: '创建公告-管理'
          }
        },
        {
          path: '/manageHome/announceList',
          name: 'AnnounceList',
          component: AnnounceList,
          meta: {
            requestAuth: true,
            title: '公告列表-管理'
          }
        },
        {
          path: '/manageHome/baseInfo',
          name: 'BaseInfo',
          component: BaseInfo,
          meta: {
            requestAuth: true,
            title: '基本信息-管理'
          }
        },
        {
          path: '/manageHome/pathManage',
          name: 'PathManage',
          component: PathManage,
          meta: {
            requestAuth: true,
            title: '路径管理-管理'
          }
        },
        {
          path: '/manageHome/adManage',
          name: 'ADManage',
          component: ADManage,
          meta: {
            requestAuth: true,
            title: '广告管理-管理'
          }
        }
      ]
    },
    {
      path: '/courseManageMain',
      name: 'CourseManageMain',
      component: CourseManageMain,
      meta: {
        requestAuth: true,
        title: '课程管理'
      }
    },
    {
      path: '/video',
      name: 'Video',
      component: CourseLearn,
      redirect: '/video/courseQC',
      meta: {
        requestAuth: true,
        title: '视频学习'
      },
      children: [
        {
          path: '/video/courseQC',
          name: 'vCourseQC',
          component: CourseQC,
          meta: {
            requestAuth: true
          }
        },
        {
          path: '/video/courseNote',
          name: 'vCourseNote',
          component: CourseNote,
          meta: {
            requestAuth: true
          }
        },
        {
          path: '/video/courseFile',
          name: 'courseFile',
          component: CourseFile,
          meta: {
            requestAuth: true
          }
        }
      ]
    },
    {
      path: '/question',
      name: 'Question',
      component: QADetail,
      meta: {
        requestAuth: true,
        title: '问答'
      }
    },
    {
      path: '/notify',
      name: 'NotifyList',
      component: NotifyList,
      meta: {
        requestAuth: true,
        title: '消息通知'
      }
    }
  ]
})
